package com.example.demo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.model.User;
import com.example.demo.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 说明：
 *
 * @author z
 * @since 2025年05月09日 星期五 02:05:58
 */
@Service
@Slf4j
public class UserServiceImpl extends ServiceImpl<BaseMapper<User>, User> implements IUserService {

    @Override
    public User getUser(String name) {
        log.info("获取用户信息：{}", name);
        QueryWrapper<User> queryWrapper = new QueryWrapper<User>()
                .eq("username", name)
                .last("limit 1");
        return getOne(queryWrapper);
    }
}